#include "stdafx.h"
#include "CustomWebBrowserEventHandler.h"

#include "net/FileDownloader.h"

#include "main_frame.h"

extern MainFrame* g_pMainFrame;

CCustomWebBrowserEventHandler::CCustomWebBrowserEventHandler(void)
{
}


CCustomWebBrowserEventHandler::~CCustomWebBrowserEventHandler(void)
{

}
void CCustomWebBrowserEventHandler::BeforeNavigate2( IDispatch *pDisp,VARIANT *&url,VARIANT *&Flags,VARIANT *&TargetFrameName,VARIANT *&PostData,VARIANT *&Headers,VARIANT_BOOL *&Cancel )
{
	int f = 0;
	CWebBrowserEventHandler::BeforeNavigate2(pDisp, url, Flags, TargetFrameName, PostData, Headers, Cancel);
}

HRESULT STDMETHODCALLTYPE CCustomWebBrowserEventHandler::Download(IMoniker *pmk, IBindCtx *pbc, DWORD dwBindVerb, LONG grfBINDF, BINDINFO *pBindInfo, LPCOLESTR pszHeaders, LPCOLESTR pszRedir, UINT uiCP)
{
	::SendMessage(g_pMainFrame->GetHWND(), WM_DOWNLOAD_FILE, (WPARAM)pszRedir, 0);
	return 1;
}